class Solution(object):
    def restoreString(self, s, indices):
        n = len(s)
        t = [''] * n
        for i, c in enumerate(s):
            t[indices[i]] = c
        return ''.join(t)